/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * 说明：
 * Entity Name 入/出库单
 * @Author：李智深
 * @Date：2012-03-14
 */
@Entity
@Table(name="ruipeng_tb_TStockInOut")
public class TStockInOut implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	private String InOutID;//入/出库单编号CHAR(15)PK
	
	private byte Type;//入/出类型TINYINT 1为入库单 2为出库单
	
	private byte SourceType;//1为采购所引起的入库，原因单为采购单编号 2为采购退货所引起的出库，原因单为退货单
							//3为销售定单所引起的出库，原因单为销售定单 4为销售退货所引起的入库，原因单为销售退货单
							//5为员工领用所引起的出库，原因单为领用单 6为报损所引起的出库，原因单为报损单 
							//7为仓库调度所引起的出库，原因单为仓库调拨单 8为仓库调度所引起的入库，原因单为仓库调拨单 
							//9为生产材料领用出库 10为生产成品入库 100为未知原因的入库 101为未知原因的出库
	
	private String Source;//原因单据编号CHAR(15)
	
	private String Operator;//操作人
	
	private Date HappenTime;//操作时间DATETIME
	
	private TStore TStore;//仓库
	
	private Date endTime;//结束时间  查询条件 不进数据库
	
	private Set<TStockInOutDetail> TStockInOutDetails=new HashSet<TStockInOutDetail>(0);
	
	public TStockInOut() {
		super();
	}

	
	public TStockInOut(com.ruipengkj.bean.TStore tStore) {
		super();
		TStore = tStore;
	}


	@Id
	@Column(name = "InOutID", length=15)
	public String getInOutID() {
		return InOutID;
	}

	public void setInOutID(String inOutID) {
		InOutID = inOutID;
	}

	@Column(name = "Type")
	public byte getType() {
		return Type;
	}

	public void setType(byte type) {
		Type = type;
	}

	@Column(name = "SourceType")
	public byte getSourceType() {
		return SourceType;
	}

	public void setSourceType(byte sourceType) {
		SourceType = sourceType;
	}

	@Column(name = "Source", length=15)
	public String getSource() {
		return Source;
	}

	public void setSource(String source) {
		Source = source;
	}

	@Column(name = "Operator", length=15)
	public String getOperator() {
		return Operator;
	}

	public void setOperator(String operator) {
		Operator = operator;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "HappenTime", nullable = false, length = 19)
	public Date getHappenTime() {
		return HappenTime;
	}

	public void setHappenTime(Date happenTime) {
		HappenTime = happenTime;
	}

	
	@ManyToOne
	@JoinColumn(name="StoreID")
	public TStore getTStore() {
		return TStore;
	}

	public void setTStore(TStore tStore) {
		TStore = tStore;
	}

	@OneToMany(mappedBy="TStockInOut")
	@JoinColumn(name="InOutID")
	public Set<TStockInOutDetail> getTStockInOutDetails() {
		return TStockInOutDetails;
	}

	public void setTStockInOutDetails(Set<TStockInOutDetail> tStockInOutDetails) {
		TStockInOutDetails = tStockInOutDetails;
	}
	
	@Transient
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
}
